trigger.js
trigger.js
is configuration of JavaScript logic when trigger is executed.
With input
variable, user can create their own logic for trigger.
Example execute.js
try {
const { historyId } = JSON.parse(decodeURIComponent(atob(input.data.params.body.message.data)))
const last_history = await service.fn.get_last_history({ "history_id": historyId, "service_token": service.token }, $)
const message_id = last_history.messagesAdded[0].message.id
const email_info = await service.fn.get_email_info({ "id": message_id, "service_token": service.token }, $)
email_info["message_info"] = await service.fn.get_payload_info(email_info.payload)
return email_info
} catch (error) {
throw error
}
Helpful?